package com.qy.changemachine;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.util.Log;

public class BootCompletedReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
            // 使用 Handler 延迟 10 秒
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    Log.d("BootCompletedReceiver", "Device booted, starting service or activity...");
//                    // 启动前台服务
//                    Intent serviceIntent = new Intent(context, MqttForegroundService.class);
//                    context.startForegroundService(serviceIntent);
                }
            }, 2000); // 延迟 1 秒（1000 毫秒）
        }

        Log.d("BootCompletedReceiver", "Device booted, starting service or activity...");


    }
}
